﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public enum ObjectKind
{
    //puzzle
    PushingStone = 1,
    TouchingButton = 2,
    StoneButton = 3,
    WallUp = 16,
    WallDown = 17,

    //trap
    TrapTimerDown = 8,
    TrapDown = 4,
    TrapUp = 20,

    //tower
    Tower = 12,

    //enemy
    Enemy = 59,

    //barril
    Barrel = 5,

    //Useless BarrelS
    Useless = 666
}

public class Objects
{
    protected ObjectKind kind;
    public ObjectKind Kind
    {
        get { return kind; }
        set { kind = value; }
    }

    private int lastCollision = 0;

    protected float xposition;
    public float XPosition
    {
        set
        {
            if (canCollide)
            {
                GameSession.CollisionMatriz[(int)xposition, (int)yposition] = lastCollision;
            }

            xposition = value;

            if (canCollide)
            {
                lastCollision = GameSession.CollisionMatriz[(int)xposition, (int)yposition];
                GameSession.CollisionMatriz[(int)xposition, (int)yposition] = 2;
            }
        }
        get { return xposition; }
    }

    protected float yposition;
    public float YPosition
    {
        set
        {
            if (canCollide)
                GameSession.CollisionMatriz[(int)xposition, (int)yposition] = 0;

            yposition = value;

            if (canCollide)
                GameSession.CollisionMatriz[(int)xposition, (int)yposition] = 2;
        }
        get { return yposition; }
    }

    protected bool canCollide;
    public bool CanCollide
    {
        set { canCollide = value; }
        get { return canCollide; }
    }

    private int paintNumber;
    public int PaintNumber
    {
        get
        {
            return (int)kind;
        }
    }

    public Objects(ObjectKind kind, int xposition, int yposition)
    {
        this.kind = kind;
        this.xposition = xposition;
        this.yposition = yposition;

        if (kind == ObjectKind.Barrel)
        {
            this.canCollide = true;
        }
        else
            this.canCollide = false;

        GameSession.CollisionMatriz[xposition, yposition] = 2;

        GameSession.ObjectsList.Add(this);
    }

    public void Update()
    {

    }
}

